package org.loginplugin;

import org.bukkit.configuration.file.FileConfiguration;

public class ConfigReader {
    public static FileConfiguration config = LoginPlugin.instance.getConfig();

    // 查询是否注册
    public static boolean isPlayerRegistered(String playerName) {
        return config.contains(playerName.toLowerCase());
    }

    // 验证密码
    public static boolean verifyPassword(String playerName, String password) {
        return password.equals(config.getString(playerName.toLowerCase()));
    }

    // 注册
    public static void addPlayer(String playerName, String password) {
        LoginPlugin.instance.getConfig().set(playerName.toLowerCase(), password);
        LoginPlugin.instance.saveConfig();
    }

}
